package com.ygqh.baby.mapper;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.ygqh.baby.ao.CompleteStatus;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.model.YgGroupBuyModel;
import com.ygqh.baby.model.YgGroupOrderRemindModel;
import com.ygqh.baby.model.YgProductGroupModel;
import com.ygqh.baby.po.YgGroupBuying;
import com.ygqh.baby.po.YgGroupBuyingExample;

public interface YgGroupBuyingMapper {
	int countByExample(YgGroupBuyingExample example);

	int deleteByExample(YgGroupBuyingExample example);

	int deleteByPrimaryKey(Long id);

	int insert(YgGroupBuying record);

	int insertSelective(YgGroupBuying record);

	List<YgGroupBuying> selectByExample(YgGroupBuyingExample example);

	YgGroupBuying selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") YgGroupBuying record, @Param("example") YgGroupBuyingExample example);

	int updateByExample(@Param("record") YgGroupBuying record, @Param("example") YgGroupBuyingExample example);

	int updateByPrimaryKeySelective(YgGroupBuying record);

	int updateByPrimaryKey(YgGroupBuying record);

	int countSuper(@Param("q") String q);

	List<YgGroupBuying> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("q") String q);

	List<YgGroupBuyModel> selectGroupBuyByGroupId(@Param("queryInfo") QueryInfo queryInfo, @Param("groupId") Long groupId);

	YgGroupBuyModel selectGroupBuyById(@Param("groupBuyId") Long groupBuyId);

	YgProductGroupModel selectProductInfoWithGroup(@Param("productId") Long productId);

	List<YgProductGroupModel> selectOtherGroupProduct(@Param("queryInfo") QueryInfo queryInfo, @Param("productId") Long productId);

	int countOtherGroupProduct(@Param("productId") Long productId);

	List<YgGroupBuyModel> selectAllGroupBuy(@Param("queryInfo") QueryInfo queryInfo);

	List<YgGroupOrderRemindModel> selectGroupOrderIncompleteReminder(@Param("limitTime") Date limitTime, @Param("startTime") Date startTime,
			@Param("endTime") Date endTime);

	List<YgGroupOrderRemindModel> selectGroupBuy4Complete(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

	int updateGbForCompleteBatch(@Param("gbList") List<YgGroupBuying> gbList);

	int updateGroupBuyAmount(@Param("id") Long id, @Param("finishAmount") Long finishAmount, @Param("completeTime") Date completeTime);

	List<YgGroupBuying> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("id") Long id, @Param("userName") String userName,
			@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("groupName") String groupName,
			@Param("completeStatus") CompleteStatus completeStatus);

	int countSuper(@Param("id") Long id, @Param("userName") String userName, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
			@Param("groupName") String groupName, @Param("completeStatus") CompleteStatus completeStatus);

	List<Long> selectSkuIdsByPids(@Param("pIds") Long[] pIds);

	int updateGbForExpireBatch(@Param("gbList") List<YgGroupBuying> gbList);

	List<Map<String, Object>> selectTuanMemberList(@Param("groupBuyId") Long groupBuyId);

}
